<?php // Silence is golden

//开放端口，提供开发用数据
function allow_cors() {
    header("Access-Control-Allow-Origin: http://localhost:5173");//指定端口可访问数据
    header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
    header("Access-Control-Allow-Headers: Content-Type, Authorization");
}

add_action('init', 'allow_cors');